package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Application;
import com.briup.recognition.bean.ApplicationExample;
import com.briup.recognition.dao.ApplicationMapper;
import org.springframework.stereotype.Service;
import com.briup.recognition.service.IApplicationService;

import javax.annotation.Resource;
import java.util.List;

    @Service
    public class ApplicationServiceImpl implements IApplicationService {

    @Resource
    private ApplicationMapper applicationMapper;

    @Override
    public  List<Application> query(){
        ApplicationExample example = new ApplicationExample();
        return applicationMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Application application){
        if (application.getId()!=null){
            applicationMapper.updateByPrimaryKey(application);
        }else{
            applicationMapper.insert(application);
        }
    }

    @Override
    public void deleteById(long id){
        applicationMapper.deleteByPrimaryKey(id);
    }
}
